No — that is one of the advantages of using StringBuffer
.
A palindrome is a String that reads the same when it is reversed. Punctuation, spaces, and capitalization are ignored. For example the following is a palindrome:
A man, a plan, a canal, Panama!
Let us write a program that determines if a String is a palindrome. To start, hard code the String in the program. Later on you can modify the program to accept user input.
class Tester { public boolean test( String trial ) { . . . . } } public class PalindromeTester { public static void main ( String[] args ) { Tester pTester = new Tester(); String trial = "A man, a plan, a canal, Panama!" ; if ( pTester.test( trial ) ) System.out.println( "Is a Palindrome" ); else System.out.println( "Not a Palindrome" ); } }